<el-dialog class="dialogStyleBase" title="设置分红" width="90%" :visible.sync="editVisible"
    :before-close="function(){excel('editForm')}" append-to-body>
    <div class="dialogStyleBaseBox" v-loading="loading">
        <el-form ref="editForm" :model="data" label-width="120px" label-position="right">
            <LayoutCell>
                <LayoutCellItem title="商品信息">
                    <el-form-item label="商品图片：">
                        <imageBox :src="form.albumUrl" style="width: 100px;height: 100px;"></imageBox>
                    </el-form-item>
                    <el-form-item label="商品名称：">
                        {{form.productName}}
                    </el-form-item>
                    <el-form-item label="商品价格/销量：">
                        <span style="display: inline-block;width: 150px;">价格：{{form.salePrice}}</span> 
                        销量：{{form.orderSales}}
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="分红设置">
                    <el-form-item label="是否参与分红">
                        <el-radio-group v-model="form.bonusSet.status">
                            <el-radio :label="0">参与</el-radio>
                            <el-radio :label="1">不参与</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="分红规则" v-if="form.bonusSet.status == 0">
                        <el-radio-group v-model="form.bonusSet.ratio_module">
                            <el-radio :label="0">默认规则</el-radio>
                            <el-radio :label="1">单独设置</el-radio>
                        </el-radio-group>
                    </el-form-item>


                    <el-form-item label="" v-if="form.bonusSet.status == 0">
                        <div v-show="form.bonusSet.ratio_module == 0">
                            <el-table v-loading="mixinTable_loading" :data="form.bonusSet.default" border
                                style="width: 100%;" :ref="mixinPage_vueName+'TableSmall'"
                                @selection-change="mixinTable_handleSelectionChangeTableSmall">
                                <el-table-column prop="level_name" label="等级名称">
                                </el-table-column>
                                <el-table-column prop="bonus.ratio" label="分红比例">
                                </el-table-column>
                            </el-table>
                        </div>
                        <div v-show="form.bonusSet.ratio_module == 1">
                            <el-table v-loading="mixinTable_loading" :data="form.bonusSet.independent_set" border
                                style="width: 100%;" :ref="mixinPage_vueName+'TableSmall'"
                                @selection-change="mixinTable_handleSelectionChangeTableSmall">
                                <el-table-column label="商品规格" width="100" v-if="form.skuStockLst.length > 1">
                                    <template slot-scope="scope" v-if="scope.row.bonus.length > 1">
                                        <div style="height: 36px;" v-for="item in scope.row.bonus">
                                            {{ item.spData.key43 }}
                                        </div>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="name" label="价格" width="100" v-if="form.skuStockLst.length > 1">
                                    <template slot-scope="scope" v-if="scope.row.bonus.length > 1">
                                        <div style="height: 36px;" v-for="item in scope.row.bonus">
                                            {{item.salePrice}}
                                        </div>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="level_name" label="等级名称" width="100">
                                </el-table-column>
                                <el-table-column label="分红比例">
                                    <template slot="header" slot-scope="scope">
                                        佣金比例
                                        <el-popover
                                            placement="bottom"
                                            title="批量设置"
                                            width="300"
                                            trigger="click"
                                            v-model="visible">
                                            <div style="display: flex;">
                                                <el-input v-model="levelValue1" clearable :disabled="levelValue2 != ''"><template slot="append">%</template></el-input>
                                                <el-input v-model="levelValue2" clearable :disabled="levelValue1 != ''"><template slot="append">元</template></el-input>
                                            </div>
                                            
                                            <div style="text-align: right; margin: 2px">
                                                <el-button size="mini" type="text" @click="visible = false">取消</el-button>
                                                <el-button type="primary" size="mini" @click="batch()">确定</el-button>
                                            </div>
                                            <i slot="reference" class="el-icon-edit"></i>
                                        </el-popover>
                                    </template>
                                    <template slot-scope="scope">
                                        <div style="display: flex;" v-for="item in scope.row.bonus">
                                            <el-input v-model="item.ratio" :disabled="item.money != ''" style="margin-bottom: 4px;"><template slot="append">%</template></el-input>
                                            <el-input v-model="item.money" :disabled="item.ratio != ''"><template slot="append">元</template></el-input>
                                        </div>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                    </el-form-item>

                </LayoutCellItem>
            </LayoutCell>
        </el-form>
    </div>
    <div slot="footer">
        <el-row>
            <el-col :span="24">
                <el-button @click="excel()">取 消</el-button>
                <el-button type="primary"
                    @click="sum()">确
                    定</el-button>
            </el-col>
        </el-row>
    </div>
</el-dialog>